Tool

CreateTool

在Project下创建Tool

请求语法

POST /accounts/<account_name>/projects/<project_name>/tools/ HTTP/1.1

Header:

Authorization: <AuthorizationString>
Date: <GMT Date>
Host: <Region Endpoint>
Content-Length: <Content Length>
Content-Type: application/json
x-gd-apiversion: 1.0
x-gd-signaturemethod: hmac-sha1-v1

Body:
{
   "tool_name": <ToolName>,
   "description": <DescriptionOfTool>,
   "tool_version": <ToolVersion>
}

请求参数

属性名称 类型 是否必须 描述
tool_name string Tool的名称,在project下必须唯一。3~128个字符,包含字母、数字、短横线”-“、下划线”_”,必须以字母开头。不支持中文Tool名称。
description string 对这个Tool的描述信息
tool_version int 默认第一个版本为1,后面版本自动加1

请求头

无特定请求头,关于GeneDock API公共请求头请参照公共请求头。

响应头

无特定响应头,关于GeneDock API公共响应头请参照公共响应头。

响应元素

HTTP状态码返回200

错误码

除了返回GeneDock API的通用错误码,还可能返回如下特有错误码

HTTP状态码 错误码 错误信息 描述
400 InvalidParameter Create tool failed,since{reason}. 创建工具失败,原因是{reason}。

请求示例

POST /accounts/genedock/projects/default/tools/ HTTP/1.1

Header:
Content-Length: 70
Connection: close
Date: Tue, 01 Nov 2016 09:41:04 GMT
Authorization: uGeneDock NEE7u2+jJXjopysRGgAvXw==:gGm7mk1e9eSvKDa7L9O1tjmOT80=

Body:
{
    "description": "testsample",
    "tool_name": "test_sample",
    "tool_version": 1
}

响应示例

HTTP/1.1 200 OK


Header:
Date:Tue, 01 Nov 2016 10:25:20 GMT
Content-Length:0
x-gd-requestid:58186d90ad023400225f45ea
Connection:close
Server:nginx/1.1.19

PutTool

更新工具描述及工具的定义信息

请求语法

PUT /accounts/<account_name>/projects/<project_name>/tools/<tool_name>/ HTTP/1.1

Header:

Authorization: <AuthorizationString>
Date: <GMT Date>
Host: <Region Endpoint>
Content-Length: <Content Length>
Content-Type: application/json
x-gd-apiversion: 1.0
x-gd-signaturemethod: hmac-sha1-v1

Body:

{
   "tool_version": <ToolVersion>,
    "description": <DescriptionOfTool>,
     "configs": <TemplateJson>
}

请求参数

属性名称 类型 是否必须 描述
tool_version int 指定tool版本号
description string tool描述信息
configs json tool配置模板

请求头

无特定请求头,关于GeneDock API公共请求头请参照公共请求头。

响应头

无特定响应头,关于GeneDock API公共响应头请参照公共响应头。

响应元素

HTTP状态码返回200

错误码

除了返回GeneDock API的通用错误码,还可能返回如下特有错误码

HTTP状态码 错误码 错误信息 描述
400 InvalidParameter Put tool definition failed,since {reason}. 修改工具配置失败,原因是{reason}。

细节描述

创建过程中遇到格式错误,必要参数遗失、或者quota超过限制等错误,则会创建失败。

请求示例

PUT /accounts/public/projects/default/tools/test_sample/

Header:

Authorization:GeneDock NEE7u2+jJXjopysRGgAvXw==:wl0AC1Hw5dLFS4pztabiVwnT0eY=
Date:Thu, 03 Nov 2016 03:17:40 GMT
Host:cn-shenzhen-api.genedock.com
Content-Length:710
Content-Type:application/json; charset=UTF-8
x-gd-apiversion: 1.0
x-gd-signaturemethod: hmac-sha1-v1

Body:
{
  "configs": {
    "alias": "ts",
    "category": "other",
    "cmd_template": "",
    "description": "test sample\n",
    "homepage": "",
    "inputs": {
      "testinput": {
        "formats": [
          "txt"
        ],
        "hint": "",
        "item": {
          "separator": ""
        },
        "maxitems": 1,
        "minitems": 0,
        "name": "testinput",
        "prefix": "",
        "required": true,
        "separator": "",
        "stdin": false,
        "type": "file"
      }
    },
    "name": "test_sample",
    "outputs": {
      "testoutput": {
        "formats": "txt",
        "hint": "",
        "item": {
          "separator": ""
        },
        "maxitems": 1,
        "minitems": 0,
        "name": "testoutput",
        "prefix": "",
        "required": true,
        "separator": "",
        "stdout": false,
        "type": "file"
      }
    },
    "parameters": {},
    "requirements": {
      "container": {
        "image": "public/snpeff:latest",
        "type": "docker"
      },
      "resources": {
        "cpu": 4,
        "disk": "4096m",
        "mem": "4096m",
        "network": false
      }
    },
    "tutorial": ""
  },
  "tool_version": 1
}

响应示例

HTTP/1.1 200 OK

Header:

Date:Thu, 03 Nov 2016 03:17:40 GMT
Content-Length: 0
x-gd-requestid:581aac34ad0234001a5f45af
Connection:close
Server:nginx/1.1.19

DeleteTool

删除工具

请求语法

DELETE /accounts/<account_name>/projects/<project_name>/tools/<tool_name>/?tool_version=<tool_version> HTTP/1.1

Header:

Authorization: <AuthorizationString>
Date: <GMT Date>
Host: <Region Endpoint>
Content-Length: <Content Length>
Content-Type: application/json
x-gd-apiversion: 1.0
x-gd-signaturemethod: hmac-sha1-v1

请求参数

属性名称 类型 是否必须 描述
tool_version int tool的版本号

请求头

无特定请求头,关于GeneDock API公共请求头请参照公共请求头。

响应头

无特定响应头,关于GeneDock API公共响应头请参照公共响应头。

响应元素

请求成功返回200

错误码

除了返回GeneDock API通用错误码,还可能返回如下特有错误码

HTTP状态码 错误码 错误信息 描述
400 InvaildParameter Delete Tool failed,since {reason}. 删除工具出错,原因是{reason}。

请求示例

DELETE /accounts/public/projects/default/tools/test1/?tool_version=1

Header:

Authorization:GeneDock NEE7u2+jJXjopysRGgAvXw==:VCq5WRamDeg1OqHjTfNxo/GlFI0=
Date:Thu, 03 Nov 2016 03:29:21 GMT
Host:cn-shenzhen-api.genedock.com
Content-Type: application/json; charset=UTF-8
x-gd-apiversion: 1.0
x-gd-signaturemethod: hmac-sha1-v1

响应示例

HTTP/1.1 200 OK

Header:

Date: Thu, 03 Nov 2016 03:29:21 GMT
Content-Length: 0
x-gd-requestid: 581aaf11ad0234001e5f45cd
Connection: close
Server: nginx/1.1.19

ListTool

ListTool接口列出当前Project下所有的Tool。

请求语法

Get /accounts/<account_name>/projects/<project_name>/tools/ HTTP/1.1

Header:

Authorization: <AuthorizationString>
Date: <GMT Date>
Host: <Region Endpoint>
Content-Length: <Content Length>
Content-Type: application/json
x-gd-apiversion: 1.0
x-gd-signaturemethod: hmac-sha1-v1

请求参数

暂无。

请求头

无特定请求头,关于GeneDock API公共请求头请参照公共请求头。

响应头

无特定响应头,关于GeneDock API公共响应头请参照公共响应头。

响应元素

ListTool请求成功,其响应的Body会包括当前Project下所有符合请求条件的Tool列表,具体格式如下:

属性名称 类型 描述
tool_url string 符合条件的tool的url
tool_name string 符合条件的tool名称
tool_version int 符合条件的tool版本
tool_id string 符合条件的tool id
description string 符合条件的tool描述信息
status string 符合条件的tool状态(checked,unchecked)
type string public、private、system
category string tool的分类信息
authorized_methods list 对tool的url可以执行的请求(GET,PUT,DELETE)
modified_time DateTime 工具的最后修改时间
created_time DateTime 创建工具时间

错误码

HTTP状态码 错误码 错误信息 描述
400 InvaildParameter List Tool failed,since {reason}. 列出工具失败,原因是{reason}。
404 ToolNotExists List Tool can‘t find anything。 找不到任何可以列出的工具

请求示例

GET /accounts/public/projects/default/tools/ HTTP/1.1

Header:

Authorization:GeneDock NEE7u2+jJXjopysRGgAvXw==:wl0AC1Hw5dLFS4pztabiVwnT0eY=
Date:Tue, 15 Nov 2016 02:23:21 GMT
Host:cn-shenzhen-api.genedock.com
Content-Length: 0
Content-Type:application/json; charset=UTF-8
x-gd-apiversion: 1.0
x-gd-signaturemethod: hmac-sha1-v1

响应示例

HTTP/1.1 200 OK

Header:

Date: Tue, 15 Nov 2016 02:23:21 GMT
Content-Length: 2041
x-gd-requestid: 581aaf11ad0234001e5f45cd
Connection: close
Server: nginx/1.1.19

Body:
{
  "items": [
    [
      {
        "authorized_methods": [
          "GET",
          "PUT",
          "DELETE"
        ],
        "category": "Structure",
        "created_time": 1468391624.0,
        "description": "\"Multivariate Analysis of Transcript Splicing (MATS)\"\n",
        "modified_time": 1468391624.0,
        "status": "checked",
        "tool_id": "5785e0c8f6f4060014c64ca7",
        "tool_name": "GeneDiffSplice_rMATS",
        "tool_url": "httphttps:://cn-shenzhen-api.genedock.com/accounts/public/projects/default/tools/GeneDiffSplice_rMATS/",
        "tool_version": 1,
        "type": "private"
      }
    ],
    [
      {
        "authorized_methods": [
          "GET",
          "PUT",
          "DELETE"
        ],
        "category": "Customize Tools",
        "created_time": 1468391628.0,
        "description": "\"Check Coding Potential of fa\"\n",
        "modified_time": 1468391628.0,
        "status": "checked",
        "tool_id": "5785e0ccf6f4060018c64caa",
        "tool_name": "NovelTrCoding_CPC",
        "tool_url": "https://cn-shenzhen-api.genedock.com/accounts/public/projects/default/tools/NovelTrCoding_CPC/",
        "tool_version": 1,
        "type": "private"
      }
    ],
    [
      {
        "authorized_methods": [
          "GET",
          "PUT",
          "DELETE"
        ],
        "category": "Aligner",
        "created_time": 1468391618.0,
        "description": "\"bowtie2 Aligner\"\n",
        "modified_time": 1468391618.0,
        "status": "checked",
        "tool_id": "5785e0c2f6f4060015c64ca7",
        "tool_name": "bowtie2 Aligner",
        "tool_url": "https://cn-shenzhen-api.genedock.com/accounts/public/projects/default/tools/bowtie2%20Aligner/",
        "tool_version": 1,
        "type": "private"
      }
    ]
  ],
  "tool_url": "https://cn-shenzhen-api.genedock.com/accounts/public/projects/default/tools/"
}

GetTool

获取指定工具的信息

请求语法

Get /accounts/<account_name>/projects/<project_name>/tools/<tool_name>/ HTTP/1.1

Header:

Authorization: <AuthorizationString>
Date: <GMT Date>
Host: <Region Endpoint>
Content-Length: <Content Length>
Content-Type: application/json
x-gd-apiversion: 1.0
x-gd-signaturemethod: hmac-sha1-v1

请求参数

属性名称 类型 是否必须 描述
tool_version int 指定Tool的版本号

请求头

无特定请求头,关于GeneDock API公共请求头请参照公共请求头。

响应头

无特定响应头,关于GeneDock API公共响应头请参照公共响应头。

响应元素

GetTool请求成功返回200,其响应的body包含description和configs,具体格式如下:

属性名称 类型 描述
description string Tool的描述信息
configs json Tool的配置信息
status string Tool的状态(checked,unchecked)
modified_time DateTime 工具的最后修改时间
created_time DateTime 创建工具时间

错误码

HTTP状态码 错误码 错误信息 描述
400 InvaildParameter Get Tool failed,since {reason}. 获取工具信息失败,原因是{原因}。
404 ToolNotExists Get Tool can‘t find anything。 找不到该工具。

请求示例

GET /accounts/public/projects/default/tools/ HTTP/1.1

Header:

Authorization:GeneDock NEE7u2+jJXjopysRGgAvXw==:y6weRwBHb8CXWfQoMdhF0eKvWSM=
Date:Thu, 03 Nov 2016 06:34:23 GMT
Host:cn-shenzhen-api.genedock.com
Content-Length: 0
Content-Type:application/json; charset=UTF-8
x-gd-apiversion: 1.0
x-gd-signaturemethod: hmac-sha1-v1

响应示例

HTTP/1.1 200 OK

Header:

Date:Thu, 03 Nov 2016 06:34:23 GMT
Content-Length:49926
x-gd-requestid:581ada6fad023400181b926c
Connection:close
Content-Type:application/json; charset=utf-8
Server:nginx/1.1.19

Body:
{
  "tools": [
    {
      "configs": {
        "_id": "580dc8a5f6f406001cf73102",
        "account": "public",
        "alias": "",
        "category": "other",
        "cmd_template": "",
        "description": "atest",
        "document_author": "public",
        "homepage": "",
        "inputs": {
          "t2": {
            "formats": [
              "axt"
            ],
            "hint": "",
            "item": {
              "separator": ""
            },
            "maxitems": 1,
            "minitems": 0,
            "name": "t2",
            "prefix": "",
            "required": true,
            "separator": "",
            "stdin": false,
            "type": "file"
          }
        },
        "modified_time": "2016-10-24 16:39:30",
        "modified_ts": 1477298370.557584,
        "name": "atest",
        "new": true,
        "outputs": {
          "t5": {
            "formats": "bb",
            "hint": "",
            "item": {
              "separator": ""
            },
            "maxitems": 1,
            "minitems": 0,
            "name": "t5",
            "prefix": "",
            "required": true,
            "separator": "",
            "stdout": false,
            "type": "file"
          }
        },
        "package": null,
        "parameters": {},
        "requirements": {
          "container": {
            "image": "public/atest:latest",
            "type": "docker"
          },
          "resources": {
            "cpu": 4,
            "disk": "4096m",
            "mem": "4096m",
            "network": false
          }
        },
        "status": "checked",
        "tutorial": null,
        "type": "private",
        "version": 1
      },
      "created_time": 1477298370.557584,
      "description": "atest",
      "modified_time": 1477298370.557584,
      "status": "checked"
    }
  ]
}

GetToolParameterTemplate

编辑工作流添加工具时,获取工具的参数模板。

请求语法

Get /accounts/<account_name>/projects/<project_name>/toolparameters/<tool_name>/?tool_version=<tool_version> / HTTP/1.1

Header:

Authorization: <AuthorizationString>
Date: <GMT Date>
Host: <Region Endpoint>
Content-Length: <Content Length>
Content-Type: application/json
x-gd-apiversion: 1.0
x-gd-signaturemethod: hmac-sha1-v1

请求参数

属性名称 类型 是否必须 描述
tool_version int 指定Tool的版本号

请求头

无特定请求头,关于GeneDock API公共请求头请参照公共请求头。

响应头

无特定响应头,关于GeneDock API公共响应头请参照公共响应头。

响应元素

GetTool请求成功返回200,其响应的body包含parameter,具体格式如下:

属性名称 类型 描述
parameter json 工具参数模板

错误码

HTTP状态码 错误码 错误信息 描述
404 ToolNotExists Get Tool can‘t find anything。 找不到该工具。

请求示例

GET /accounts/public/projects/default/toolparameters/test_tools/?tool_version=1 HTTP/1.1

Header:

Authorization:GeneDock NEE7u2+jJXjopysRGgAvXw==:5+jILNErlhVSGZU1CCx/jh6LMbs=
Date:Thu, 03 Nov 2016 07:12:26 GMT
Host:cn-shenzhen-api.genedock.com
Content-Type:application/json; charset=UTF-8
x-gd-apiversion: 1.0
x-gd-signaturemethod: hmac-sha1-v1

响应示例

HTTP/1.1 200 OK

Header:

Server:nginx/1.1.19
Date:Thu, 03 Nov 2016 07:12:26 GMT
Content-Type:application/json; charset=utf-8
Content-Length:622
Connection:close
x-gd-requestid:581ae35aad023400121b9269
Content-MD5:xMQUUbr5kRYrdwlpHgOj0w==
Access-Control-Allow-Origin:https://www.genedock.com

Body:
{
  "parameter": [
    {
      "account": "*****",
      "alias": "snpEff",
      "app_id": "559ccd78f6f4061e79c7861f",
      "category": "Annotation Tools",
      "description": "\"Genetic variant annotation and effect prediction toolbox. It annotates and predicts the effects of variants on genes (such as amino acid changes) \"\n",
      "inputs": {
        "vcf": [
          {
            "enid": ""
          }
        ]
      },
      "name": "snpEff",
      "outputs": {
        "output": [
          {
            "enid": ""
          }
        ]
      },
      "parameters": {
        "test_parameter": {
          "variable": false,
          "type": "string",
          "value": "test"
        }
      },
      "version": 1
    }
  ]
}

GetToolDetails

用于获取工具输入输出和参数等详情

请求语法

Get /accounts/<account_name>/projects/<project_name>/tooldetails/<tool_name>/?tool_version=<tool_version> / HTTP/1.1 

Header: 
Authorization: <AuthorizationString> 
Date: <GMT Date> Host: <Region Endpoint> 
Content-Length: <Content Length> 
Content-Type: application/json 
x-gd-apiversion: 1.0 
x-gd-signaturemethod: hmac-sha1-v1

请求参数

属性名称 类型 是否必须 描述
tool_version int 指定Tool的版本号

请求头

无特定请求头,关于GeneDock API公共请求头请参照公共请求头。

响应头

无特定响应头,关于GeneDock API公共响应头请参照公共响应头。

响应元素

属性名称 类型 描述
inputs dict 工具的输入项(保留最大个数,最小个数,文件类型)
outputs dict 工具的输出项(保留最大个数,最小个数,文件类型)
parameters dict 工具的参数项(保留备注,默认值,参数类型)
description string 工具描述
document_author string 工具配置作者
alias string 工具别名
version int 工具版本号
homepage string 工具主页
modified_time DateTime 最后修改时间
tool_name string 工具名称

错误码

HTTP状态码 错误码 错误信息 描述
400 InvaildParameter Get Tool failed,since {reason}. 获取工具信息失败,原因是{原因}。
404 ToolNotExists Get Tool can‘t find anything。 找不到该工具。

请求示例

GET /accounts/public/projects/default/tooldetails/test_tools/?tool_version=1 HTTP/1.1

Header:

Authorization:GeneDock NEE7u2+jJXjopysRGgAvXw==:5+jILNErlhVSGZU1CCx/jh6LMbs=
Date:Thu, 03 Nov 2016 07:12:26 GMT
Host:cn-shenzhen-api.genedock.com
Content-Type:application/json; charset=UTF-8
x-gd-apiversion: 1.0
x-gd-signaturemethod: hmac-sha1-v1

响应示例

HTTP/1.1 200 OK

Header:

Server:nginx/1.1.19
Date:Thu, 03 Nov 2016 07:12:26 GMT
Content-Type:application/json; charset=utf-8
Content-Length:582
Connection:close
x-gd-requestid:581ae35aad023400121b9269
Content-MD5:xMQUUbr5kRYrdwlpHgOj0w==
Access-Control-Allow-Origin:https://www.genedock.com

Body:
[
  {
    "details": {
      "inputs": {
        "a": {
          "minitems": 0,
          "maxitems": 1,
          "formats": [
            "2bit",
            "Rdata"
          ]
        }
      },
      "description": "test_tools",
      "parameters": {
        "default": "test",
        "type": "string",
        "hint": "test parameter"
      },
      "document_author": "luxitong",
      "outputs": {
        "a": {
          "minitems": 0,
          "maxitems": 1,
          "formats": "123,456"
        }
      },
      "alias": "test_tools",
      "version": 1,
      "homepage": ""
    },
    "modified_time": 1474624020.997488,
    "tool_name": "test_tools"
  }
]